package com.fengpt.shardingjdbc.conf;

import io.shardingsphere.api.algorithm.sharding.PreciseShardingValue;
import io.shardingsphere.api.algorithm.sharding.standard.PreciseShardingAlgorithm;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import java.util.Collection;

/**
 * @author fengpt
 * @createTime 2020年04月02日 14:41:00
 */
@Slf4j
@Configuration
public class DataSourceAlg implements PreciseShardingAlgorithm<String> {

    @Override
    public String doSharding(Collection<String> names, PreciseShardingValue<String> value) {
        log.debug("分库算法参数 {},{}",names,value);

        return "db_01" ;
    }
}
